package game;

import java.io.File;
import javax.sound.sampled.*;

public class ClipPlayer extends MusicPlayer {
	private AudioInputStream in;
	private AudioFormat format;
	
	public ClipPlayer(String s, float f){
		super(f);
		try{
			in = AudioSystem.getAudioInputStream(new File(s));
		}catch(Exception e){}
		format = in.getFormat();
		DataLine.Info info = new DataLine.Info(Clip.class, format);
		try{
			out = (Clip)AudioSystem.getLine(info);
		}catch (Exception e){}
		try{
			((Clip)out).open(in);
		}catch(Exception e){}
		setVolume(volume);
	}
	
	public void run(){
		out.start();
	}
}
